package com.nnk.action;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.log4j.Logger;

import com.nnk.main.Main;
import com.nnk.threads.ScanFileThread;

import nnk.msgsrv.server.Request;

public class FileChecker {
	
	Logger log = Logger.getLogger(FileChecker.class);
	public static ExecutorService executor = Executors.newFixedThreadPool(100); 
	public void check(Request request){
		//R:appname cmd sn type remotepath note
		//S:appanme cmd sn type remotepath note md5 
		String content = request.getContent();
		String[] req = content.split(" +");
		String ftpPath = req[2];
		String separator = System.getProperty("file.separator");
		String filePath = Main.ini.getDefaultPath() + separator +
				ftpPath.replaceAll("^\\.?/?", "");
		executor.execute(new ScanFileThread(filePath, request));
	}
	public static void main(String...arg){
		String path = ".sta/aaa";
		System.out.println(path.replaceAll("^\\.?/?", ""));
	}
}
